SET SERVEROUTPUT ON;

- -Procedure to insert a new student

create or replace procedure addStudent(pstuId char, plastname char, pfirstname char, pmajor char, pcredits number) AS

BEGIN
insert into student(stuId, lastname, firstname, major, credits)
values(pstuId, plastname, pfirstname, pmajor, pcredits);

DBMS_OUTPUT.PUT_LINE('New record entered successfully');
exception
when dup_val_on_index then
DBMS_OUTPUT.PUT_LINE('Duplicate stuId');
when others then
DBMS_OUTPUT.PUT_LINE('Error-' || SQLERRM);

END;
/